#pragma once
#include "stdafx.h"
class PhysXBoxObject
{
protected:
	Ogre::SceneNode* ogreNode;
	NxActorDesc actorDesc;				
	NxBoxShapeDesc boxDesc;
	NxActor* actor;
	NxBodyDesc bodyDesc;
public:
	public:
	PhysXBoxObject(Ogre::SceneNode* ogreNode, NxScene* physXScene)
	{
		this->ogreNode = ogreNode;
		boxDesc.dimensions.set(ogreNode->getScale().x*0.5f,
				ogreNode->getScale().y*0.5f,
				ogreNode->getScale().z*0.5f);	
		actorDesc.shapes.pushBack(&boxDesc);
		actorDesc.body = &bodyDesc;
		actorDesc.density = 10;
		actorDesc.globalPose.t 	= NxVec3(ogreNode->getPosition().x,
					ogreNode->getPosition().y,
					ogreNode->getPosition().z);		
		actor = physXScene->createActor(actorDesc);
	}
	void update()
	{
		ogreNode->setOrientation(actor->getGlobalOrientationQuat().w,
				actor->getGlobalOrientationQuat().x,
				actor->getGlobalOrientationQuat().y,
				actor->getGlobalOrientationQuat().z);
		ogreNode->setPosition(actor->getGlobalPosition().x,
				actor->getGlobalPosition().y,
				actor->getGlobalPosition().z);
	}

};

